package day08.tesk;

public abstract class Animal {
    protected int age;

    public Animal(int age) {
        this.age=age;
    }

    public abstract void printInfo();
}

class Bird extends Animal {
    protected String color;

    public Bird(String color, int age) {
        super(age);
        this.color = color;
    }

    @Override
    public void printInfo() {
        System.out.println("我是一只" + color + "的鸟！");
        System.out.println("我今年" + age + "岁了");
    }
}

class Fish extends Animal {
    protected int weight;

    public Fish(int weight,int age ) {
        super(age);
        this.weight = weight;
    }

    @Override
    public void printInfo() {
        System.out.println("我是一只" + weight + "斤重的鱼！");
        System.out.println("我今年" + age + "岁了");
    }
}

class Main {
    public static void main(String[] args) {
        Bird bird = new Bird("红色", 6);
        Fish fish=new Fish(10,3);
        bird.printInfo();
        fish.printInfo();
    }
}
